{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "8e1aea18",
   "metadata": {},
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "from scipy.special import binom"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "10a9ae52",
   "metadata": {},
   "outputs": [],
   "source": [
    "bernstein = lambda n, k, t: binom(n, k) * t ** k * (1. - t) ** (n - k)\n",
    "def bezier(points, num=200):\n",
    "    N = len(points)\n",
    "    t = np.linspace(0, 1, num=num)\n",
    "    curve = np.zeros((num, 2))\n",
    "    for i in range(N):\n",
    "        curve += np.outer(bernstein(N - 1, i, t), points[i])\n",
    "    return curve"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "35dc9acb",
   "metadata": {},
   "outputs": [],
   "source": [
    "p = np.zeros((4, 2))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c58f660d",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "09ea130e",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "de589d5f",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "3bd003dc",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d63cff22",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "27a7a2f0",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
